package com.atmosphere.component.base;

import com.atmosphere.interfaces.IComponent;
import com.atmosphere.interfaces.IComponentKey;

/**
 * <code>AbstractComponent</code> defines the basic abstraction
 * of a component unit within the atmosphere system. It provides
 * the most basic functionalities and fields shared by all the
 * component units.
 *
 * @author Yi Wang (Neakor)
 * @version Creation date: 05-19-2009 17:06 EST
 * @version Modified date: 05-19-2009 17:08 EST
 */
public abstract class AbstractComponent implements IComponent {
	/**
	 * The <code>IComponentKey</code>.
	 */
	protected final IComponentKey key;

	/**
	 * Constructor of <code>AbstractComponent</code>.
	 * @param key The <code>IComponentKey</code>.
	 */
	protected AbstractComponent(IComponentKey key) {
		if(key == null) throw new IllegalArgumentException("Key cannot be null.");
		this.key = key;
	}
	
	@Override
	public IComponentKey getKey() {
		return this.key;
	}
}
